//
//  ViewController.m
//  reading
//
//  Created by xingshuai on 2020/10/9.
//

#import "ViewController.h"

#import "XSVoiceDemo.h"

@interface ViewController ()

@property (nonatomic,strong) UITextField *textF;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.textF = [[UITextField alloc]initWithFrame:CGRectMake(50, 100, self.view.frame.size.width-100, 100)];
    self.textF.placeholder = @"输入要朗读的文字";
    self.textF.backgroundColor = [UIColor orangeColor];
    [self.view addSubview:self.textF];
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    button.frame = CGRectMake(50, 260, self.view.frame.size.width-100, 50);
    [button setTitle:@"朗读" forState:UIControlStateNormal];
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [button setBackgroundColor:[UIColor blackColor]];
    [button addTarget:self action:@selector(clicks) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    
}

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [self.view endEditing:YES];
}

-(void)clicks {
    [[XSVoiceDemo shareInstance] speakWithWorks:self.textF.text];
}




@end
